package com.tddx.activiti.utils;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ConnectionUtil {
	
	@Autowired private DataSource ds;
	
	public Connection getConnection(){
		
		try {
			return ds.getConnection();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
		
	}
	
	public DatabaseMetaData getDmd(){
		
		try {
			return getConnection().getMetaData();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
